<script setup>
import InputEditer from '../components/InputEditer.vue'
import { ref, onMounted, nextTick } from 'vue'
import { dataProcessing_operation } from '../js/dataPro_operation.js'
import { _getData } from '/src/api/parameterConfiguration/getData.js'
import { mainStore } from '/src/store/mainStore.js'

const store = mainStore()

let data_1 = ref(null)
let data_2 = ref(null)

const getList = async () => {
  const res = await _getData(store.cutArgPage)

  if (res?.data?.code != 200) return ElMessage.error('获取数据失败')
  const data = dataProcessing_operation(res.data.data)

  data_1.value = data.data_1
  data_2.value = data.data_2
}

getList()
let height = ref('0px')
onMounted(() => {
  nextTick(() => {
    const h = document.querySelector('.opera-container').getBoundingClientRect().height
    height.value = h - 100 + 'px'
  })
})
</script>

<template>
  <div class="opera-container">
    <!-- 主要的参数 -->
    <h3>运维监控</h3>
    <!-- 头部的输入-->
    <div class="show-main" v-if="data_1">
      <div class="title">{{ data_1.title }}</div>
      <div v-for="item in data_1.data">
        <InputEditer :data="item" :width="260" />
      </div>
    </div>

    <div class="show-main" v-if="data_2">
      <div class="title">{{ data_2.title }}</div>
      <div v-for="item in data_2.data">
        <InputEditer :data="item" :width="260" />
      </div>
    </div>
  </div>
</template>

<style lang="less" scoped>
.opera-container {
  width: 100%;
  height: 100%;
  font-size: 14px;
  padding: 0 6px 0 20px;
  display: flex;
  flex-direction: column;
}

.show-main {
  width: 100%;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  padding: 20px 40px;
  // border-bottom: 1px solid #ccc;
  overflow-y: auto;
  > div {
    width: 700px;
    margin-right: 80px;
    margin-bottom: 20px;
  }
}

.title {
  width: 100%;
  margin-top: 10px;
  display: flex;
  align-items: center;
  color: blue;
  font-size: 14px;
}

.selecdCss {
  color: white;
  background-color: #4095e5 !important;
}

h3 {
  width: 100%;
  margin-top: 20px;
}
</style>
